<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="区域">
              <j-depart-select v-model="queryParam.EXTRA_DATA_orgCode"></j-depart-select>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="姓名">
              <a-input placeholder="请输入姓名或首字母" v-model="queryParam.EXTRA_DATA_firstLetter"></a-input>
<!--              <j-user-select v-model="queryParam.EXTRA_DATA_residentName"></j-user-select>-->
              <!--              <a-input placeholder="请输入姓名" v-model="queryParam.residentName"></a-input>-->
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="家庭编号">
              <a-input placeholder="请输入家庭编号" v-model="queryParam.familyCode"></a-input>
            </a-form-item>
          </a-col>

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
<!--              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>-->
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
<!--    <div class="table-operator">
      <a-button type="primary" icon="download" @click="handleExportXls('vca_family')">导出</a-button>
    </div>-->

    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="familyNum" slot-scope="text,record">
          <a-badge v-if="record.extinct==1" count="整户死亡">
            <span>{{text}}</span>
          </a-badge>
          <span v-else>{{text}}</span>
        </template>

        <span slot="action" slot-scope="text, record">
          <a @click="handleDetail(record)">详情</a>
        </span>

      </a-table>
    </div>
    <vca-family-detail ref="modalForm" @ok="modalFormOk"></vca-family-detail>
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import JDepartSelect from '@/components/jeecg/JDepartSelect'
  import VcaFamilyDetail from './modules/VcaFamilyDetail'

  export default {
    name: 'VcaFamilyList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {JDepartSelect,VcaFamilyDetail },
    data () {
      return {
        description: 'vca_family管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'家庭编号',
            align:"center",
            dataIndex: 'familyCode'
          },{
            title:'户主',
            align:"center",
            dataIndex: 'hostName'
          },
          {
            title:'家庭人数',
            align:"center",
            dataIndex: 'familyNum',
            scopedSlots: {customRender: "familyNum"}
          },
          {
            title:'户籍地址',
            align:"center",
            dataIndex: 'depart.departFullName'
          },
          {
            title:'创建人',
            align:"center",
            dataIndex: 'createBy'
          },
          {
            title:'创建日期',
            align:"center",
            dataIndex: 'createTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/villageCadreAssist/vcaFamily/list",
          delete: "/villageCadreAssist/vcaFamily/delete",
          deleteBatch: "/villageCadreAssist/vcaFamily/deleteBatch",
          exportXlsUrl: "/villageCadreAssist/vcaFamily/exportXls",
          importExcelUrl: "villageCadreAssist/vcaFamily/importExcel",

        },
        dictOptions:{}
      }
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      }
    },
    methods: {
      initDictConfig(){
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>